package com.huanwei.mainfragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.huanwei.cc.R;
import com.huanwei.cc.activity.ZhouBian_Activity;
import com.huanwei.map.School_details_Activity;
import com.huanwei.read.MeiRi_Activity;
import com.huanwei.teacher_school.School_oneActivity;
import com.huanwei.teacher_school.TeacherFour_Activity;
import com.huanwei.teacher_school.TeacherOne_Activity;
import com.huanwei.teacher_school.TeacherTwo_Activity;
import com.huanwei.teacher_school.Teacher_ThreeActivity;


import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.drakeet.materialdialog.MaterialDialog;

/**
 * 首页
 */
public class SY1_Fragment extends Fragment {

    View view;
    @BindView(R.id.im_gydt)
    ImageView imGydt;
    @BindView(R.id.layout_gydt)
    RelativeLayout layoutGydt;
    @BindView(R.id.im_cdhq)
    ImageView imCdhq;
    @BindView(R.id.layout_schq)
    RelativeLayout layoutSchq;
    @BindView(R.id.im_wdcg)
    ImageView imWdcg;
    @BindView(R.id.layout_wdcg)
    RelativeLayout layoutWdcg;
    @BindView(R.id.imageView4)
    ImageView imageView4;
    @BindView(R.id.textView16)
    TextView textView16;
    @BindView(R.id.imageView7)
    ImageView imageView7;
    @BindView(R.id.imageView5)
    ImageView imageView5;
    @BindView(R.id.textView13)
    TextView textView13;
    @BindView(R.id.keb)
    RelativeLayout keb;
    @BindView(R.id.imageView6)
    ImageView imageView6;
    @BindView(R.id.textView15)
    TextView textView15;
    @BindView(R.id.textView3)
    TextView textView3;
    @BindView(R.id.textView4)
    TextView textView4;
    @BindView(R.id.textView5)
    TextView textView5;
    @BindView(R.id.textView6)
    TextView textView6;
    @BindView(R.id.imageView)
    ImageView imageView;
    @BindView(R.id.textView2)
    TextView textView2;
    @BindView(R.id.im_sc)
    ImageView imSc;
    @BindView(R.id.tv_sg)
    TextView tvSg;
    @BindView(R.id.textView8)
    TextView textView8;

    @BindView(R.id.im_sg)
    ImageView imSg;
    @BindView(R.id.tv_sc)
    TextView tvSc;
    @BindView(R.id.textView9)
    TextView textView9;

    @BindView(R.id.im_dl)
    ImageView imDl;
    @BindView(R.id.tv_jl)
    TextView tvJl;
    @BindView(R.id.textView10)
    TextView textView10;

    @BindView(R.id.im_gg)
    ImageView imGg;
    @BindView(R.id.tv_dl)
    TextView tvDl;
    @BindView(R.id.textView11)
    TextView textView11;


    @BindView(R.id.xuanze)
    RelativeLayout xuanze;
    @BindView(R.id.xyxw)
    RelativeLayout xyxw;
    @BindView(R.id.layout_teacher1)
    RelativeLayout layoutTeacher1;
    @BindView(R.id.layout_teacher2)
    RelativeLayout layoutTeacher2;
    @BindView(R.id.layout_teacher3)
    RelativeLayout layoutTeacher3;
    @BindView(R.id.layout_teacher4)
    RelativeLayout layoutTeacher4;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (view == null) {
            view = View.inflate(getActivity(), R.layout.fragment_shou_y, null);

        }
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null) {
            parent.removeView(view);
        }
        ButterKnife.bind(this, view);
        return view;
    }

//    @OnClick({R.id.im_gydt, R.id.layout_gydt, R.id.keb,R.id.xuanze,  R.id.xyxw} )
//    public void onClick(View view) {
//        switch (view.getId()) {
//            case R.id.im_gydt:
//                break;
//            case R.id.keb:
//                startActivity(new Intent(getActivity(), KCB_R_Activity.class));
//                break;
//            case R.id.xyxw:
//                startActivity(new Intent(getActivity(), Xin_Activity.class));
//                break;
//            case R.id.xuanze:
////                Toast.makeText(getContext(), "2222", Toast.LENGTH_SHORT).show();
//                show();
//                break;
//
//        }
//    }

    MaterialDialog mMaterialDialog;

    public void show() {
        mMaterialDialog = new MaterialDialog(getActivity())
                .setTitle("提示")
                .setMessage("请选择学院!")
                .setPositiveButton("数计院", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        textView16.setText("数计院");
                        mMaterialDialog.dismiss();

                    }
                })
                .setNegativeButton("生科院", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        textView16.setText("生科院");
                        mMaterialDialog.dismiss();

                    }
                });

        mMaterialDialog.show();
    }


    @OnClick({R.id.layout_teacher1,
            R.id.meishi,
            R.id.
                    jieshao, R.id.layout_teacher2, R.id.layout_teacher3, R.id.layout_teacher4, R.id.im_gydt, R.id.layout_gydt, R.id.keb, R.id.xuanze, R.id.xyxw})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.layout_teacher1:
                startActivity(new Intent(getActivity(), TeacherOne_Activity.class));
                break;
            case R.id.layout_teacher2:
                startActivity(new Intent(getActivity(), TeacherTwo_Activity.class));
                break;
            case R.id.layout_teacher3:
                startActivity(new Intent(getActivity(), Teacher_ThreeActivity.class));
                break;
            case R.id.layout_teacher4:
                startActivity(new Intent(getActivity(), TeacherFour_Activity.class));
                break;
            case R.id.keb:
                startActivity(new Intent(getActivity(), School_details_Activity.class));
                break;
            case R.id.xyxw:
                startActivity(new Intent(getActivity(), MeiRi_Activity.class));
                break;
            case R.id.xuanze:
//                Toast.makeText(getContext(), "2222", Toast.LENGTH_SHORT).show();
                show();
                break;
            case R.id.jieshao:

                startActivity(new Intent(getActivity(), School_oneActivity.class));
                break;

            case R.id.meishi:

                startActivity(new Intent(getActivity(), ZhouBian_Activity.class));
                break;

        }
    }
}
